<%--
  Created by IntelliJ IDEA.
  User: 刘科
  Date: 2020/12/18
  Time: 16:44
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<div class="mainl left">
    <div class="cpfl">
        <h2><img src="../images/cpfl.png"></h2>
        <div class="flcon">
            <ul id="classify">

            </ul>
        </div>
    </div>
    <!-- ny_lx end -->
</div>
<script type="text/javascript">
    $.ajax({
        type: "GET",
        url: serverUrl + "/types/queryTypes",
        dataType: "json",
        xhrFields: {
            withCredentials: true
        },
        success: function (res) {
            $("#classify").empty();
            $("#classify").append("<li><a id='-1' onclick='queryByClass(this)'>所有农产品</a></li>");
            if (res.success) {
                var resData = res.data;
                for (var i = 0; i < resData.length; i++) {
                    $("#classify").append("<li> <a onclick='queryByClass(this)' id="+ resData[i].tsId +" >"+ resData[i].tsName +"</a></li>")
                }
            }
        },
        error: function (res) {
            alert("请求服务器错误");
        }
    });
</script>
